import React from 'react';
import styles from './index.less';
import { Form, Input} from 'antd';
import funcs from './funcs';

const FormItem = Form.Item;

export default class extends React.Component {
    constructor(props) {
        super(props);

        this.state = {
            addTagVisible: false
        };

        this.func = funcs(this, styles);
    }

    render() {
        const {
            config,
            value,
            onChange,
            status,
            onDelTag,
            onAddTag
        } = this.props;

        return (
            <div className={'render-item-wrapper'}>
                <FormItem
                    name={config.key}
                    label={config.label}
                    rules={status === 'browse' ? [] : (config.rules || [])}
                    className={'render-item-form-item'}
                >
                    {this.func.renderForm(config, status, value)}
                </FormItem>
            </div>
        );
    }
}